-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
service/iam: iam_principal_policy_simulation data source #25569
service/iam: iam_principal_policy_simulation data source #25569
Conversation
d54973c
to
4de5795
Compare
This data source wraps the IAM policy simulation API. This was previously a data source with little utility in Terraform, but with the introduction of preconditions and postconditions in Terraform v1.2.3 it can be potentially useful as a way for a configuration to either pre-verify that it seems to be running with credentials that confer sufficient access or to self-check a policy it declares itself to get earlier warning if the policy seems insufficient for its intended purpose. Unfortunately the IAM policy simulator is pretty low-level and requires the caller to figure out all of the relevant details of how a real AWS service would make requests to IAM at runtime in order to construct a fully-realistic simulation, but thankfully in practice it seems like authors could make do with relatively-simple "naive" simulations unless they know they are using more complex IAM policy features, such as custom conditions or interpolations.
4de5795
to
0031038
Compare
# Conflicts: # internal/provider/provider.go
…alPolicySimulationDataSource_basic'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
% make testacc TESTARGS='-run=TestAccIAMPrincipalPolicySimulationDataSource' PKG=iam
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run=TestAccIAMPrincipalPolicySimulationDataSource -timeout 180m
=== RUN TestAccIAMPrincipalPolicySimulationDataSource_basic
=== PAUSE TestAccIAMPrincipalPolicySimulationDataSource_basic
=== CONT TestAccIAMPrincipalPolicySimulationDataSource_basic
--- PASS: TestAccIAMPrincipalPolicySimulationDataSource_basic (27.03s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/iam 32.824s
@apparentlymart Thanks for the contribution 🎉 👏. |
This functionality has been released in v5.2.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
This data source wraps the IAM policy simulation API. This was previously an API action with little utility in Terraform, but with the introduction of preconditions and postconditions in Terraform v1.2.3 it can be potentially useful as a way for a configuration to either pre-verify that it seems to be running with credentials that confer sufficient access or to self-check a policy it declares itself to get earlier warning if the policy seems insufficient for its intended purpose.
Unfortunately the IAM policy simulator is pretty low-level and requires the caller to figure out all of the relevant details of how a real AWS service would make requests to IAM at runtime in order to construct a fully-realistic simulation, but thankfully in practice it seems like authors could make do with relatively-simple "naive" simulations unless they know they are using more complex IAM policy features, such as custom conditions or interpolations. I included some hopefully-realistic examples in the documentation.
Community Note
Output from acceptance testing: